
#include "TaisanErrorInfo.h"
#include <assert.h>
#include <string>

static struct error_info_t s_error_infos[] = {
	{ 0, NULL, "Success" },
	{ 1001, "Downloader", "HTTP 400 bad request" },
	{ 1002, "Downloader", "HTTP 401 unauthorized" },
	{ 1003, "Downloader", "HTTP 403 forbidden" },
	{ 1004, "Downloader", "HTTP 404 not found" },
	{ 1005, "Downloader", "HTTP 405 method not allowed" },
	{ 1006, "Downloader", "HTTP 410 gone" },
	{ 1007, "Downloader", "HTTP 500 internal server error" },
	{ 1008, "Downloader", "HTTP 502 bad gateway" },
	{ 1009, "Downloader", "HTTP 503 service unavailable" },
	{ 1010, "Downloader", "HTTP 504 gateway timeout" },
	{ 1011, "Downloader", "HTTP other error" },
	{ 1012, "Downloader", "Connection refused" },
	{ 1013, "Downloader", "No route to host" },
	{ 1014, "Downloader", "Name or service not known" },
	{ 1015, "Downloader", "Temporary failure in name resolution" },
	{ 1016, "Downloader", "File size unchanged time out" },
	{ 1017, "Downloader", "HTTP Content-Length is zero" },
	{ 1018, "Downloader", "Unsupported scheme" },
	{ 1019, "Downloader", "Log file of downloader is empty" },
	{ 2001, "Crawler", "Call system() error" },
	{ 2002, "Crawler", "Page integrity check error" },
	{ 2003, "Crawler", "Page encoding convert failed" },
	{ 2004, "Crawler", "Page parse error" },
	{ 2005, "Crawler", "Downloaded file size is empty" },
	{ 2006, "Crawler", "DNA generation failed" },
	{ 2007, "Crawler", "Input params error" },
	{ 2008, "Crawler", "Video removed" },
	{ 2009, "Crawler", "Video access limited" },
	{ 2010, "Crawler", "Unsupported website" },
	{ 2011, "Crawler", "Thumbnail download error(deprecated)" },
	{ 2012, "Crawler", "Is external video" },
	{ 2013, "Crawler", "Unsupported video" },
	{ 2014, "Crawler", "Access denied" },
	{ 2015, "Crawler", "Filesystem IO error" },
	{ 2016, "Crawler", "Too many click URLs" },
	{ 2017, "Crawler", "Waiting for UDD response timeout" },
	{ 2018, "Crawler", "Directory click_url not exist" },
	{ 2019, "Crawler", "Firefox not started" },
	{ 2020, "Crawler", "DNA query failed" },
	{ 2021, "Crawler", "Reserve resource failed" },
	{ 2022, "Crawler", "Rating failed" },
	{ 2023, "Crawler", "Unsupported search type" },
	{ 2024, "Crawler", "Resource file download error" },
	{ 3001, "Rating", "Unsupported action" },
	{ 3002, "Rating", "Meta data update failed" },
	{ 3003, "Rating", "Bad request params" },
	{ 3004, "Rating", "Rating failed" },
	{ 3005, "Rating", "Rating client error" },
	{ 4001, "UDD", "Firefox initialization failed" },
	{ 4002, "UDD", "Click page load failed" },
	{ 4003, "UDD", "Unexpected click page" },
	{ 4004, "UDD", "Click failed" },
	{ 4005, "UDD", "Unable to fetch redirect URL" },
	{ 4006, "UDD", "Current UDD task time out" },
	{ 5001, "Task Recorder", "Invalid task input" },
	{ 5002, "Task Recorder", "Invalid crawler output" },
	{ 5003, "Task Recorder", "Database operation failed" },
	{ 6001, "Task Worker", "Crawler execution timeout" },
	{ 6002, "Task Worker", "Empty crawler output" },
	{ 6003, "Task Worker", "Call crawler error" },
	{ 6004, "Task Worker", "Crawler abnormal exit" },
	{ 7001, "Timeout Task Recorder", "Task dispatch timeout" },
	{ 7002, "Timeout Task Recorder", "Task execution timeout" },
	{ 8001, "TSCenter", "Unsupported priority" },
	{ 8002, "TSCenter", "Exceed center capacity" },
	{ 8003, "TSCenter", "Exceed partition capacity" }
};

TaisanErrorInfo::TaisanErrorInfo( void )
{
	m_err_size = sizeof(s_error_infos) / sizeof(struct error_info_t);
	mp_info = s_error_infos;
}

const char *TaisanErrorInfo::GetErrorType( void )
{
	return "Taisan";
}

